home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / ident / patches / lpmud-ident-patch.txt < prev    next >
Encoding:
Text File  |  1992-08-12  |  3.2 KB  |  133 lines

  1.  
  2.                 query_ident()
  3.  
  4.         Peter Eriksson <pen@lysator.liu.se>
  5.                 aka
  6.               Lpd @ NannyMUD
  7.  
  8.  
  9. Description:
  10.  
  11.   Below follows what changes are needed to implement the function
  12.   query_ident() which returns the token that was retrieved by the
  13.   Identification Server Protocol (see RFC931 or the future new revision
  14.   of a similar protocol). A server for the Ident protocol can be FTP'd from
  15.   'ftp.lysator.liu.se' in the directory 'pub/ident'. You must be Root to
  16.   install that server. With this function you can (if the remote site
  17.   is running an Ident server) see not only from which host a user is
  18.   connecting, but also his user name.
  19.  
  20.   In addition to the following patches to the LPMUD driver you will need
  21.   the authuser library. It can be FTP'd from 'ftp.lysator.liu.se' in the
  22.   directory 'pub/ident' as 'libauthuser-4.0-p2.tar.Z'.
  23.  
  24.  
  25. Usage:
  26.  
  27.   string query_ident(void|object);
  28.  
  29.  
  30. Example:
  31.  
  32.   write("My ident token is: " + query_ident() + ".\n");
  33.  
  34.   write("Player " + ob->short + "'s ident token is: " +
  35.     query_ident(ob) + ".\n");
  36.  
  37.  
  38. Patchlist:
  39.  
  40.   func_spec.c: Add this in alphabetic order in the list of functions.:
  41.  
  42.     string query_ident(void|object);  
  43.  
  44.  
  45.   interpret.c: Add this in the huge switch with all the EFUNs:
  46.  
  47.     #ifdef F_QUERY_IDENT
  48.       CASE(F_QUERY_IDENT);
  49.       {
  50.         extern char *query_ident PROT((struct object *));
  51.         char *tmp;
  52.         struct svalue *arg1;
  53.  
  54.         if (!command_giver || !command_giver->interactive)
  55.         error("query_ident(): illegal caller\n");
  56.  
  57.         arg1 = sapply("query_level_sec", command_giver, 0);
  58.         if (!arg1 || arg1->type != T_NUMBER || arg1->u.number < 22)
  59.       error("query_ident(): illegal caller\n");
  60.       
  61.         if (num_arg == 1 && sp->type != T_OBJECT)
  62.       error("Bad optional argument to query_ident()\n");
  63.  
  64.         tmp = query_ident(num_arg ? sp->u.ob : 0);
  65.         if (num_arg)
  66.         pop_stack();
  67.         if (tmp == 0)
  68.       push_number(0);
  69.         else
  70.       push_string(tmp, STRING_MALLOC);
  71.         break;
  72.       }
  73.     #endif
  74.  
  75.  
  76.   comm1.c: Just before the first function declaration
  77.        "int socket PROT((...));" insert:
  78.  
  79.     #include <authuser.h>
  80.  
  81.   comm1.c: Add this before the function "new_player()":
  82.  
  83.     char *ident_get_identifier(fd)
  84.       int fd;
  85.     {
  86.       extern int auth_fd2();
  87.       extern char *auth_tcpuser3();
  88.           
  89.       unsigned long inlocal;
  90.       unsigned long inremote;
  91.       unsigned short local;
  92.       unsigned short remote;
  93.     
  94.     
  95.       if (auth_fd2(fd, &inlocal, &inremote,
  96.                &local, &remote) == -1)
  97.         return NULL;
  98.     
  99.       return auth_tcpuser2(inlocal, inremote, local, remote, 30);
  100.     }
  101.  
  102.  
  103.   comm1.c: Add this in the function 'new_player()', just after
  104.            the call to 'set_prompt("> ");':
  105.  
  106.     {
  107.       char *userid = ident_get_identifier(new_socket);
  108.  
  109.       master_ob->interactive->ident = 
  110.         userid ? make_shared_string(userid) : 0;
  111.      }
  112.  
  113.  
  114.   comm1.c: Add this just before the definition of 'add_ip_entry()':
  115.  
  116.     char *query_ident(ob)
  117.       struct object *ob;
  118.     {
  119.       if (ob == 0)
  120.         ob = command_giver;
  121.   
  122.       if (!ob || ob->interactive == 0)
  123.         return 0;
  124.   
  125.       return ob->interactive->ident;
  126.     }
  127.  
  128.  
  129.   Makefile: Change the "LIBS=" line to include "-lauthuser":
  130.  
  131.     LIBS= -lm -lauthuser # util/gc/gc.a
  132.  
  133.